<?php
namespace app\common\controller;

use think\Session;

/**
* 
*/
class IndexBase extends Base
{
	public $userInfo;
    public $titleName;
    public $isWinxin;

    public function _initialize() {

        parent::_initialize();
        //判断是是否登录
        if( Session::has("userInfo") ){
            $user_info = Session::get("userInfo");
            if( empty($user_info) ){

                $this->redirect('index/Login/index');
            }
            $this->userInfo = $user_info;
        }else{
            $this->redirect('index/Login/index');
        }
        if( is_weixin() ){

            $this->isWinxin = true;
        }else{
            $this->isWinxin = false;
        }

        /*$userArr = app_model("index","user")->getuserInfo($this->userInfo["id"],"a.nickname,a.account,a.portrait,a.add_time,b.*,l.id as level_id,l.level");
        $userArr["end_time"] = date("m/d/Y H:i:s",$userArr["add_time"]+60*60*24*27);
        print_r($userArr);
        $this->assign("userArr",$userArr);*/

    }

    public function fetch($template = '', $vars = [], $replace = [], $config = []){
    	
        $this->assign( "title",$this->configArr["company"]." ".$this->titleName );
        return parent::fetch($template, $vars, $replace, $config);
    }
}